/**
 * 
 */
package com.davetrudes.jung.client.visualization.event;

import com.google.gwt.event.shared.GwtEvent;



/**
 * @author dave.trudes
 *
 */
public class ItemEvent extends GwtEvent<ItemListener>{

	/**
     * Event type for drag start events. Represents the meta-data associated with
     * this event.
     */
    public static final GwtEvent.Type<ItemListener> TYPE = new GwtEvent.Type<ItemListener>();
    
	public static final int ITEM_FIRST = 701;
	
	public static final int ITEM_LAST = 701;
	
	public static final int ITEM_STATE_CHANGED = ITEM_FIRST; //Event.LIST_SELECT

	public static final int SELECTED = 1;
	
	public static final int DESELECTED = 2;
	
	Object item;
	
	int stateChanged;
	
	ItemSelectable source;
	int id;
	
	public ItemEvent(ItemSelectable source, int id, Object item, int stateChanged){
		this.source = source;
		this.id = id;
		this.item = item;
		this.stateChanged = stateChanged;
	}

	@Override
	public Type<ItemListener> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(ItemListener handler) {
		handler.itemStateChanged(this);
		
	}
}
